package main.java.com.amanda.utils;

import edu.princeton.cs.algs4.In;
import edu.princeton.cs.algs4.StdIn;
import edu.princeton.cs.algs4.StdOut;

/**
 * @author amanda
 * @Description 白名单过滤器
 */
public class AllowFilter {
    private AllowFilter() {
    }
    public static void main(String[] args) {
        SET<String> set = new SET<String>();
        // read in strings and add to set
        In in = new In(args[0]);
        while (!in.isEmpty()) {
            String word = in.readString();
            set.add(word);
        }
        while (!StdIn.isEmpty()) {
            String word = StdIn.readString();
            if (set.contains(word))
                StdOut.println(word);
        }
    }
}